import evaluateBooleanExpression from '../src/utils/evaluateBooleanExpression/evaluateBooleanExpression';

describe('evaluateBooleanExpression result isEqual eval result', () => {
  it('eval test true', () => {
    const expression: string = 'true';
    const customizeResult = evaluateBooleanExpression(expression);
    const evalResult = eval(expression);
    expect(customizeResult).toEqual(evalResult);
  });

  it('eval test false', () => {
    const expression: string = 'false';
    const customizeResult = evaluateBooleanExpression(expression);
    const evalResult = eval(expression);
    expect(customizeResult).toEqual(evalResult);
  });

  it('eval test true && false', () => {
    const expression: string = 'true && false';
    const customizeResult = evaluateBooleanExpression(expression);
    const evalResult = eval(expression);
    expect(customizeResult).toEqual(evalResult);
  });

  it('eval test true && (true || false)', () => {
    const expression: string = 'true && (true || false)';
    const customizeResult = evaluateBooleanExpression(expression);
    const evalResult = eval(expression);
    expect(customizeResult).toEqual(evalResult);
  });

  it('eval test false || true || false || true', () => {
    const expression: string = 'false || true || false || true';
    const customizeResult = evaluateBooleanExpression(expression);
    const evalResult = eval(expression);
    expect(customizeResult).toEqual(evalResult);
  });
});
